package org.jupiter.blog.api.convertor;

import org.jupiter.blog.api.domain.JupiterPermission;
import org.jupiter.blog.api.dto.JupiterPermissionDTO;
import org.jupiter.blog.api.dto.JupiterPermissionTreeDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper(componentModel = "spring")
public interface JupiterPermissionStructConvertor {

	@Mapping(target = "createTime", ignore = true)
	@Mapping(target = "updateTime", ignore = true)
	@Mapping(target = "deleteTime", ignore = true)
	JupiterPermission toEntity(JupiterPermissionDTO dto);

	@Mapping(target = "size", ignore = true)
	@Mapping(target = "pageSort", ignore = true)
	@Mapping(target = "page", ignore = true)
	JupiterPermissionDTO toDto(JupiterPermission permission);

	// 添加集合转换方法
	List<JupiterPermissionDTO> toDtoList(List<JupiterPermission> permissions);

	List<JupiterPermission> toEntityList(List<JupiterPermissionDTO> permissionDtos);

	List<JupiterPermissionTreeDTO> toTreeDtoList(List<JupiterPermission> permissions);
}
